package com.example.shop.user.dao;

import com.example.shop.common.bo.Page;
import com.example.shop.user.dto.GoodsCollection;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GoodsCollectionDao {

    @Results(id = "GoodsCollectionDaoResultMap",value = {
            @Result(column = "goods_collection_datetime",property = "goodsCollectionDateTime"),
            @Result(column = "goods_id",property = "goodsInfo",
                    one = @One(select = "com.example.shop.goods.dao.GoodsBrowseInfoDao.selectById"))
    })
    @Select("select goods_id,goods_collection_datetime " +
            "from r_user_goods_collection " +
            "where user_id = ${userId} " +
            "limit ${(page.pageIndex-1)*page.pageSize},${page.pageSize}")
    List<GoodsCollection> selectByPage(@Param("userId") long userId,@Param("page") Page page);
}
